﻿<UserControl x:Class="SLExtensions.Showcase.PageAnimation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:anim="clr-namespace:SLExtensions.Controls.Animation;assembly=SLExtensions.Controls"
    xmlns:slei="clr-namespace:SLExtensions.Input;assembly=SLExtensions"
    >
    <UserControl.Resources>
        <Storyboard x:Name="anim1">
            <DoubleAnimation Storyboard.TargetName="marginWrapper1" Storyboard.TargetProperty="MarginLeft" To="150" Duration="0:00:01"/>
        </Storyboard>
    </UserControl.Resources>
    <StackPanel x:Name="LayoutRoot" Background="White">
        <StackPanel Orientation="Horizontal">
            <Button Content="Start" slei:CommandService.Command="BeginStoryboard" slei:CommandService.CommandParameter="anim1" />
            <Button Content="Stop" slei:CommandService.Command="StopStoryboard" slei:CommandService.CommandParameter="anim1"/>
                <Grid Width="400" Height="100">
                    <anim:MarginWrapper x:Name="marginWrapper1" ElementName="rect1" MarginLeft="50" />
                    <Rectangle x:Name="rect1" Fill="Red" Width="50" Height="50" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="50,0,0,0" />
                </Grid>
            </StackPanel>
    </StackPanel>
</UserControl>
